package com.ls.blog.utils;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ls.blog.dto.Recodes;
import com.ls.blog.vo.PageVO;

public class PageUtils {

    /**
     * 统一分页结果
     * @param page
     * @param <T>
     * @return
     */
    public static <T> Recodes<T> page(IPage<T> page){
        return new Recodes<T>(page);
    }

    /**
     * 分页转换
     */
    public static PageVO translate(PageVO pageVO){
        long start = (pageVO.getCurrent()-1)*pageVO.getPageSize();
        pageVO.setCurrent(start);
        return pageVO;
    }


}
